﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FrmSetValueFilter.aspx.cs"
    Inherits="EXAM.Admin.Page_Admin.Windows.FrmSetValueFilter" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        #form1
        {
            text-align: center;
        }
        #Button1
        {
            width: 138px;
        }
    </style>
</head>
<body onload="ConfigureDialog()">
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

        <script type="text/javascript">
        function GetRadWindow()
        {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }
        function ConfigureDialog()
		{		
			var oWindow = GetRadWindow();	
		
			var oArg = oWindow.Argument;
			if(document.getElementById("hdCode").value=="")
			{
			
                document.getElementById("hdCode").value=	oArg.CODE;	                
			    __doPostBack('<%=btnReload.UniqueID  %>','');
			}
		}
        function returnToParent()
        {
            var info = new Object();
                     
           var type = document.getElementById ("<%=hdType.ClientID %>");
           if(type.value=="")
           {
           var from = $find ("<%=txtFrom.ClientID %>").get_value();
            var to =  $find ("<%=txtTo.ClientID %>").get_value();  
            } 
            else if(type.value=="SDN")
            {   
                var from = $find ("<%=dpFrom.ClientID %>").get_dateInput().get_selectedDate();
                if(from==null)
                    from="19000101";
                else
                    from=from._toFormattedString("yyyyMMdd","");
                var to =  $find ("<%=dpTo.ClientID %>").get_dateInput().get_selectedDate();  
                if(to==null)
                    to="19000101";
                else
                    to=to._toFormattedString("yyyyMMdd","");
            }
            else
            {
            var from = $find ("<%=numFrom.ClientID %>").get_value();
            if(from==0)
            from=1900001;
            var to =  $find ("<%=numTo.ClientID %>").get_value();  
            if(to==0)
            to=1900001;
            }
            try
            {
                info.FROM=from;
                info.TO=to;
            }
            catch(e)
            {                
            }            
            var oWnd =GetRadWindow();
            if(info)
            {          
                oWnd.close(info);
            }
            else
            {
                alert("Chưa chọn !!!"); 
            }   
        }
        </script>

    </telerik:RadCodeBlock>
    <div title="OK">
        <table width="100%">
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="Lọc Từ"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="Lọc Đến"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <telerik:RadTextBox ID="txtFrom" runat="server" Visible="False">
                    </telerik:RadTextBox>
                    <telerik:RadNumericTextBox ID="numFrom" runat="server" Visible="False">
                    </telerik:RadNumericTextBox>
                    <telerik:RadDatePicker ID="dpFrom" runat="server" Visible="False" MaxDate="2900-12-31"
                        MinDate="1900-01-01">
                        <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x">
                        </Calendar>
                        <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                    </telerik:RadDatePicker>
                    <asp:Label ID="lbFrom" runat="server"></asp:Label>
                </td>
                <td>
                    <telerik:RadTextBox ID="txtTo" runat="server" Visible="False">
                    </telerik:RadTextBox>
                    <telerik:RadNumericTextBox ID="numTo" runat="server" Visible="False">
                    </telerik:RadNumericTextBox>
                    <telerik:RadDatePicker ID="dpTo" runat="server" Visible="False" MaxDate="2900-12-31"
                        MinDate="1900-01-01">
                        <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x">
                        </Calendar>
                        <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                    </telerik:RadDatePicker>
                    <asp:Label ID="lbTo" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    <div>
        <input id="Button1" type="button" value="OK" onclick="returnToParent()" />&nbsp;
        <asp:Button ID="btnReload" runat="server" Text="Reload" OnClick="btnReload_Click" />
    </div>
    <asp:HiddenField ID="hdCode" runat="server" />
    <asp:HiddenField ID="hdType" runat="server" />
    </form>
</body>
</html>
